1 module directx.d3dx11tex;
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 //  Copyright (C) Microsoft Corporation.  All Rights Reserved.
5 //
6 //  File:       d3dx11tex.h
7 //  Content:    D3DX11 texturing APIs
8 //
9 //////////////////////////////////////////////////////////////////////////////
10 
11 version(Windows):
12 version(Direct3D_11):
13 
14 import directx.com;
15 import directx.win32;
16 import directx.d3dx11;
17 
18 //----------------------------------------------------------------------------
19 // D3DX11_FILTER flags:
20 // ------------------
21 //
22 // A valid filter must contain one of these values:
23 //
24 //  D3DX11_FILTER_NONE
25 //      No scaling or filtering will take place.  Pixels outside the bounds
26 //      of the source image are assumed to be transparent black.
27 //  D3DX11_FILTER_POINT
28 //      Each destination pixel is computed by sampling the nearest pixel
29 //      from the source image.
30 //  D3DX11_FILTER_LINEAR
31 //      Each destination pixel is computed by linearly interpolating between
32 //      the nearest pixels in the source image.  This filter works best 
33 //      when the scale on each axis is less than 2.
34 //  D3DX11_FILTER_TRIANGLE
35 //      Every pixel in the source image contributes equally to the
36 //      destination image.  This is the slowest of all the filters.
37 //  D3DX11_FILTER_BOX
38 //      Each pixel is computed by averaging a 2x2(x2) box pixels from 
39 //      the source image. Only works when the dimensions of the 
40 //      destination are half those of the source. (as with mip maps)
41 //
42 // And can be OR'd with any of these optional flags:
43 //
44 //  D3DX11_FILTER_MIRROR_U
45 //      Indicates that pixels off the edge of the texture on the U-axis
46 //      should be mirrored, not wraped.
47 //  D3DX11_FILTER_MIRROR_V
48 //      Indicates that pixels off the edge of the texture on the V-axis
49 //      should be mirrored, not wraped.
50 //  D3DX11_FILTER_MIRROR_W
51 //      Indicates that pixels off the edge of the texture on the W-axis
52 //      should be mirrored, not wraped.
53 //  D3DX11_FILTER_MIRROR
54 //      Same as specifying D3DX11_FILTER_MIRROR_U | D3DX11_FILTER_MIRROR_V |
55 //      D3DX11_FILTER_MIRROR_V
56 //  D3DX11_FILTER_DITHER
57 //      Dithers the resulting image using a 4x4 order dither pattern.
58 //  D3DX11_FILTER_SRGB_IN
59 //      Denotes that the input data is in sRGB (gamma 2.2) colorspace.
60 //  D3DX11_FILTER_SRGB_OUT
61 //      Denotes that the output data is in sRGB (gamma 2.2) colorspace.
62 //  D3DX11_FILTER_SRGB
63 //      Same as specifying D3DX11_FILTER_SRGB_IN | D3DX11_FILTER_SRGB_OUT
64 //
65 //----------------------------------------------------------------------------
66 
67 alias D3DX11_FILTER_FLAG = int;
68 enum : D3DX11_FILTER_FLAG
69 {
70     D3DX11_FILTER_NONE            =   (1 << 0),
71     D3DX11_FILTER_POINT           =   (2 << 0),
72     D3DX11_FILTER_LINEAR          =   (3 << 0),
73     D3DX11_FILTER_TRIANGLE        =   (4 << 0),
74     D3DX11_FILTER_BOX             =   (5 << 0),
75 
76     D3DX11_FILTER_MIRROR_U        =   (1 << 16),
77     D3DX11_FILTER_MIRROR_V        =   (2 << 16),
78     D3DX11_FILTER_MIRROR_W        =   (4 << 16),
79     D3DX11_FILTER_MIRROR          =   (7 << 16),
80 
81     D3DX11_FILTER_DITHER          =   (1 << 19),
82     D3DX11_FILTER_DITHER_DIFFUSION=   (2 << 19),
83 
84     D3DX11_FILTER_SRGB_IN         =   (1 << 21),
85     D3DX11_FILTER_SRGB_OUT        =   (2 << 21),
86     D3DX11_FILTER_SRGB            =   (3 << 21),
87 }
88 
89 //----------------------------------------------------------------------------
90 // D3DX11_NORMALMAP flags:
91 // ---------------------
92 // These flags are used to control how D3DX11ComputeNormalMap generates normal
93 // maps.  Any number of these flags may be OR'd together in any combination.
94 //
95 //  D3DX11_NORMALMAP_MIRROR_U
96 //      Indicates that pixels off the edge of the texture on the U-axis
97 //      should be mirrored, not wraped.
98 //  D3DX11_NORMALMAP_MIRROR_V
99 //      Indicates that pixels off the edge of the texture on the V-axis
100 //      should be mirrored, not wraped.
101 //  D3DX11_NORMALMAP_MIRROR
102 //      Same as specifying D3DX11_NORMALMAP_MIRROR_U | D3DX11_NORMALMAP_MIRROR_V
103 //  D3DX11_NORMALMAP_INVERTSIGN
104 //      Inverts the direction of each normal 
105 //  D3DX11_NORMALMAP_COMPUTE_OCCLUSION
106 //      Compute the per pixel Occlusion term and encodes it into the alpha.
107 //      An Alpha of 1 means that the pixel is not obscured in anyway, and
108 //      an alpha of 0 would mean that the pixel is completly obscured.
109 //
110 //----------------------------------------------------------------------------
111 
112 alias D3DX11_NORMALMAP_FLAG = int;
113 enum : D3DX11_NORMALMAP_FLAG
114 {
115     D3DX11_NORMALMAP_MIRROR_U          =   (1 << 16),
116     D3DX11_NORMALMAP_MIRROR_V          =   (2 << 16),
117     D3DX11_NORMALMAP_MIRROR            =   (3 << 16),
118     D3DX11_NORMALMAP_INVERTSIGN        =   (8 << 16),
119     D3DX11_NORMALMAP_COMPUTE_OCCLUSION =   (16 << 16),
120 }
121 
122 //----------------------------------------------------------------------------
123 // D3DX11_CHANNEL flags:
124 // -------------------
125 // These flags are used by functions which operate on or more channels
126 // in a texture.
127 //
128 // D3DX11_CHANNEL_RED
129 //     Indicates the red channel should be used
130 // D3DX11_CHANNEL_BLUE
131 //     Indicates the blue channel should be used
132 // D3DX11_CHANNEL_GREEN
133 //     Indicates the green channel should be used
134 // D3DX11_CHANNEL_ALPHA
135 //     Indicates the alpha channel should be used
136 // D3DX11_CHANNEL_LUMINANCE
137 //     Indicates the luminaces of the red green and blue channels should be 
138 //     used.
139 //
140 //----------------------------------------------------------------------------
141 
142 alias D3DX11_CHANNEL_FLAG = int;
143 enum : D3DX11_CHANNEL_FLAG
144 {
145     D3DX11_CHANNEL_RED           =    (1 << 0),
146     D3DX11_CHANNEL_BLUE          =    (1 << 1),
147     D3DX11_CHANNEL_GREEN         =    (1 << 2),
148     D3DX11_CHANNEL_ALPHA         =    (1 << 3),
149     D3DX11_CHANNEL_LUMINANCE     =    (1 << 4),
150 };
151 
152 
153 
154 //----------------------------------------------------------------------------
155 // D3DX11_IMAGE_FILE_FORMAT:
156 // ---------------------
157 // This enum is used to describe supported image file formats.
158 //
159 //----------------------------------------------------------------------------
160 
161 alias D3DX11_IMAGE_FILE_FORMAT = int;
162 enum : D3DX11_IMAGE_FILE_FORMAT
163 {
164     D3DX11_IFF_BMP         = 0,
165     D3DX11_IFF_JPG         = 1,
166     D3DX11_IFF_PNG         = 3,
167     D3DX11_IFF_DDS         = 4,
168     D3DX11_IFF_TIFF		  = 10,
169     D3DX11_IFF_GIF		  = 11,
170     D3DX11_IFF_WMP		  = 12,
171     D3DX11_IFF_FORCE_DWORD = 0x7fffffff
172 
173 }
174 
175 
176 //----------------------------------------------------------------------------
177 // D3DX11_SAVE_TEXTURE_FLAG:
178 // ---------------------
179 // This enum is used to support texture saving options.
180 //
181 //----------------------------------------------------------------------------
182 
183 alias D3DX11_SAVE_TEXTURE_FLAG = int;
184 enum : D3DX11_SAVE_TEXTURE_FLAG
185 {
186     D3DX11_STF_USEINPUTBLOB      = 0x0001,
187 }
188 
189 
190 //----------------------------------------------------------------------------
191 // D3DX11_IMAGE_INFO:
192 // ---------------
193 // This structure is used to return a rough description of what the
194 // the original contents of an image file looked like.
195 // 
196 //  Width
197 //      Width of original image in pixels
198 //  Height
199 //      Height of original image in pixels
200 //  Depth
201 //      Depth of original image in pixels
202 //  ArraySize
203 //      Array size in textures
204 //  MipLevels
205 //      Number of mip levels in original image
206 //  MiscFlags
207 //      Miscellaneous flags
208 //  Format
209 //      D3D format which most closely describes the data in original image
210 //  ResourceDimension
211 //      D3D11_RESOURCE_DIMENSION representing the dimension of texture stored in the file.
212 //      D3D11_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D
213 //  ImageFileFormat
214 //      D3DX11_IMAGE_FILE_FORMAT representing the format of the image file.
215 //----------------------------------------------------------------------------
216 
217 struct D3DX11_IMAGE_INFO
218 {
219     UINT                        Width;
220     UINT                        Height;
221     UINT                        Depth;
222     UINT                        ArraySize;
223     UINT                        MipLevels;
224     UINT                        MiscFlags;
225     DXGI_FORMAT                 Format;
226     D3D11_RESOURCE_DIMENSION    ResourceDimension;
227     D3DX11_IMAGE_FILE_FORMAT    ImageFileFormat;
228 }
229 
230 
231 
232 
233 //////////////////////////////////////////////////////////////////////////////
234 // Image File APIs ///////////////////////////////////////////////////////////
235 //////////////////////////////////////////////////////////////////////////////
236 
237 //----------------------------------------------------------------------------
238 // D3DX11_IMAGE_LOAD_INFO:
239 // ---------------
240 // This structure can be optionally passed in to texture loader APIs to 
241 // control how textures get loaded. Pass in D3DX11_DEFAULT for any of these
242 // to have D3DX automatically pick defaults based on the source file.
243 // 
244 //  Width
245 //      Rescale texture to Width texels wide
246 //  Height
247 //      Rescale texture to Height texels high
248 //  Depth
249 //      Rescale texture to Depth texels deep
250 //  FirstMipLevel
251 //      First mip level to load
252 //  MipLevels
253 //      Number of mip levels to load after the first level
254 //  Usage
255 //      D3D11_USAGE flag for the new texture
256 //  BindFlags
257 //      D3D11 Bind flags for the new texture
258 //  CpuAccessFlags
259 //      D3D11 CPU Access flags for the new texture
260 //  MiscFlags
261 //      Reserved. Must be 0
262 //  Format
263 //      Resample texture to the specified format
264 //  Filter
265 //      Filter the texture using the specified filter (only when resampling)
266 //  MipFilter
267 //      Filter the texture mip levels using the specified filter (only if 
268 //      generating mips)
269 //  pSrcInfo
270 //      (optional) pointer to a D3DX11_IMAGE_INFO structure that will get 
271 //      populated with source image information
272 //----------------------------------------------------------------------------
273 
274 
275 struct D3DX11_IMAGE_LOAD_INFO
276 {
277     UINT                       Width             = D3DX11_DEFAULT;
278     UINT                       Height            = D3DX11_DEFAULT;
279     UINT                       Depth             = D3DX11_DEFAULT;
280     UINT                       FirstMipLevel     = D3DX11_DEFAULT;
281     UINT                       MipLevels         = D3DX11_DEFAULT;
282     D3D11_USAGE                Usage             = cast(D3D11_USAGE) D3DX11_DEFAULT;
283     UINT                       BindFlags         = D3DX11_DEFAULT;
284     UINT                       CpuAccessFlags    = D3DX11_DEFAULT;
285     UINT                       MiscFlags         = D3DX11_DEFAULT;
286     DXGI_FORMAT                Format            = DXGI_FORMAT_FROM_FILE;
287     UINT                       Filter            = D3DX11_DEFAULT;
288     UINT                       MipFilter         = D3DX11_DEFAULT;
289     D3DX11_IMAGE_INFO*         pSrcInfo;
290 }
291 
292 //-------------------------------------------------------------------------------
293 // GetImageInfoFromFile/Resource/Memory:
294 // ------------------------------
295 // Fills in a D3DX11_IMAGE_INFO struct with information about an image file.
296 //
297 // Parameters:
298 //  pSrcFile
299 //      File name of the source image.
300 //  pSrcModule
301 //      Module where resource is located, or NULL for module associated
302 //      with image the os used to create the current process.
303 //  pSrcResource
304 //      Resource name.
305 //  pSrcData
306 //      Pointer to file in memory.
307 //  SrcDataSize
308 //      Size in bytes of file in memory.
309 //  pPump
310 //      Optional pointer to a thread pump object to use.
311 //  pSrcInfo
312 //      Pointer to a D3DX11_IMAGE_INFO structure to be filled in with the 
313 //      description of the data in the source image file.
314 //  pHResult
315 //      Pointer to a memory location to receive the return value upon completion.
316 //      Maybe NULL if not needed.
317 //      If pPump != NULL, pHResult must be a valid memory location until the
318 //      the asynchronous execution completes.
319 //-------------------------------------------------------------------------------
320 
321 extern(Windows) 
322 HRESULT 
323 	D3DX11GetImageInfoFromFileA(
324         LPCSTR                    pSrcFile,
325         ID3DX11ThreadPump         pPump,
326         D3DX11_IMAGE_INFO*        pSrcInfo,
327         HRESULT*                  pHResult);
328 		
329 extern(Windows)
330 HRESULT 
331 	D3DX11GetImageInfoFromFileW(
332         LPCWSTR                   pSrcFile,
333         ID3DX11ThreadPump         pPump,
334         D3DX11_IMAGE_INFO*        pSrcInfo,
335         HRESULT*                  pHResult);
336 
337 alias D3DX11GetImageInfoFromFileW D3DX11GetImageInfoFromFile;
338 
339 
340 extern(Windows)
341 HRESULT 
342 	D3DX11GetImageInfoFromResourceA(
343         HMODULE                   hSrcModule,
344         LPCSTR                    pSrcResource,
345         ID3DX11ThreadPump         pPump,
346         D3DX11_IMAGE_INFO*        pSrcInfo,
347         HRESULT*                  pHResult);
348 
349 extern(Windows)
350 HRESULT 
351 	D3DX11GetImageInfoFromResourceW(
352         HMODULE                   hSrcModule,
353         LPCWSTR                   pSrcResource,
354         ID3DX11ThreadPump         pPump,
355         D3DX11_IMAGE_INFO*        pSrcInfo,
356         HRESULT*                  pHResult);
357 
358 alias D3DX11GetImageInfoFromResourceW D3DX11GetImageInfoFromResource;
359 
360 
361 extern(Windows)
362 HRESULT 
363 	D3DX11GetImageInfoFromMemory(
364         LPCVOID                   pSrcData,
365         SIZE_T                    SrcDataSize,
366         ID3DX11ThreadPump         pPump,
367         D3DX11_IMAGE_INFO*        pSrcInfo,
368         HRESULT*                  pHResult);
369 
370 
371 //////////////////////////////////////////////////////////////////////////////
372 // Create/Save Texture APIs //////////////////////////////////////////////////
373 //////////////////////////////////////////////////////////////////////////////
374 
375 //----------------------------------------------------------------------------
376 // D3DX11CreateTextureFromFile/Resource/Memory:
377 // D3DX11CreateShaderResourceViewFromFile/Resource/Memory:
378 // -----------------------------------
379 // Create a texture object from a file or resource.
380 //
381 // Parameters:
382 //
383 //  pDevice
384 //      The D3D device with which the texture is going to be used.
385 //  pSrcFile
386 //      File name.
387 //  hSrcModule
388 //      Module handle. if NULL, current module will be used.
389 //  pSrcResource
390 //      Resource name in module
391 //  pvSrcData
392 //      Pointer to file in memory.
393 //  SrcDataSize
394 //      Size in bytes of file in memory.
395 //  pLoadInfo
396 //      Optional pointer to a D3DX11_IMAGE_LOAD_INFO structure that
397 //      contains additional loader parameters.
398 //  pPump
399 //      Optional pointer to a thread pump object to use.
400 //  ppTexture
401 //      [out] Created texture object.
402 //  ppShaderResourceView
403 //      [out] Shader resource view object created.
404 //  pHResult
405 //      Pointer to a memory location to receive the return value upon completion.
406 //      Maybe NULL if not needed.
407 //      If pPump != NULL, pHResult must be a valid memory location until the
408 //      the asynchronous execution completes.
409 //
410 //----------------------------------------------------------------------------
411 
412 
413 // FromFile
414 extern(Windows)
415 HRESULT
416     D3DX11CreateShaderResourceViewFromFileA(
417         ID3D11Device                pDevice,
418         LPCSTR                      pSrcFile,
419         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
420         ID3DX11ThreadPump           pPump,
421         ID3D11ShaderResourceView*   ppShaderResourceView,
422         HRESULT*                    pHResult);
423 
424 extern(Windows)
425 HRESULT
426     D3DX11CreateShaderResourceViewFromFileW(
427         ID3D11Device               pDevice,
428         LPCWSTR                     pSrcFile,
429         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
430         ID3DX11ThreadPump           pPump,
431         ID3D11ShaderResourceView*   ppShaderResourceView,
432         HRESULT*                    pHResult);
433 
434 alias D3DX11CreateShaderResourceViewFromFileW D3DX11CreateShaderResourceViewFromFile;
435 
436 
437 extern(Windows)
438 HRESULT
439     D3DX11CreateTextureFromFileA(
440         ID3D11Device                pDevice,
441         LPCSTR                      pSrcFile,
442         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
443         ID3DX11ThreadPump           pPump,
444         ID3D11Resource*             ppTexture,
445         HRESULT*                    pHResult);
446 		
447 		
448 extern(Windows)
449 HRESULT
450     D3DX11CreateTextureFromFileW(
451         ID3D11Device                pDevice,
452         LPCWSTR                     pSrcFile,
453         D3DX11_IMAGE_LOAD_INFO*     pLoadInfo,
454         ID3DX11ThreadPump           pPump,
455         ID3D11Resource*             ppTexture,
456         HRESULT*                    pHResult);
457 
458 alias D3DX11CreateTextureFromFileW D3DX11CreateTextureFromFile;
459 
460 
461 // FromResource (resources in dll/exes)
462 extern(Windows)
463 HRESULT
464     D3DX11CreateShaderResourceViewFromResourceA(
465         ID3D11Device               pDevice,
466         HMODULE                    hSrcModule,
467         LPCSTR                     pSrcResource,
468         D3DX11_IMAGE_LOAD_INFO*    pLoadInfo,
469         ID3DX11ThreadPump          pPump,
470         ID3D11ShaderResourceView*  ppShaderResourceView,
471         HRESULT*                   pHResult);
472 		
473 extern(Windows)
474 HRESULT
475     D3DX11CreateShaderResourceViewFromResourceW(
476         ID3D11Device               pDevice,
477         HMODULE                    hSrcModule,
478         LPCWSTR                    pSrcResource,
479         D3DX11_IMAGE_LOAD_INFO*    pLoadInfo,
480         ID3DX11ThreadPump          pPump,
481         ID3D11ShaderResourceView*  ppShaderResourceView,
482         HRESULT*                   pHResult);
483 
484 alias D3DX11CreateShaderResourceViewFromResourceW D3DX11CreateShaderResourceViewFromResource;
485 
486 
487 extern(Windows)
488 HRESULT
489     D3DX11CreateTextureFromResourceA(
490         ID3D11Device             pDevice,
491         HMODULE                  hSrcModule,
492         LPCSTR                   pSrcResource,
493         D3DX11_IMAGE_LOAD_INFO*  pLoadInfo,  
494         ID3DX11ThreadPump        pPump,   
495         ID3D11Resource*          ppTexture,
496         HRESULT*                 pHResult);
497 		
498 extern(Windows)
499 HRESULT
500     D3DX11CreateTextureFromResourceW(
501         ID3D11Device             pDevice,
502         HMODULE                  hSrcModule,
503         LPCWSTR                  pSrcResource,
504         D3DX11_IMAGE_LOAD_INFO*  pLoadInfo,
505         ID3DX11ThreadPump        pPump,
506         ID3D11Resource*          ppTexture,
507         HRESULT*                 pHResult);
508 
509 alias D3DX11CreateTextureFromResourceW D3DX11CreateTextureFromResource;
510 
511 
512 // FromFileInMemory
513 extern(Windows)
514 HRESULT
515     D3DX11CreateShaderResourceViewFromMemory(
516         ID3D11Device               pDevice,
517         LPCVOID                    pSrcData,
518         SIZE_T                     SrcDataSize,
519         D3DX11_IMAGE_LOAD_INFO*    pLoadInfo,
520         ID3DX11ThreadPump          pPump,        
521         ID3D11ShaderResourceView*  ppShaderResourceView,
522         HRESULT*                   pHResult);
523 		
524 extern(Windows)
525 HRESULT
526     D3DX11CreateTextureFromMemory(
527         ID3D11Device              pDevice,
528         LPCVOID                   pSrcData,
529         SIZE_T                    SrcDataSize,
530         D3DX11_IMAGE_LOAD_INFO*   pLoadInfo,    
531         ID3DX11ThreadPump         pPump,    
532         ID3D11Resource*           ppTexture,
533         HRESULT*                  pHResult);
534 
535 
536 //////////////////////////////////////////////////////////////////////////////
537 // Misc Texture APIs /////////////////////////////////////////////////////////
538 //////////////////////////////////////////////////////////////////////////////
539 
540 //----------------------------------------------------------------------------
541 // D3DX11_TEXTURE_LOAD_INFO:
542 // ------------------------
543 //
544 //----------------------------------------------------------------------------
545 
546 struct D3DX11_TEXTURE_LOAD_INFO
547 {
548     D3D11_BOX       *pSrcBox;
549     D3D11_BOX       *pDstBox;
550     UINT            SrcFirstMip;
551     UINT            DstFirstMip;
552     UINT            NumMips               = D3DX11_DEFAULT;
553     UINT            SrcFirstElement;
554     UINT            DstFirstElement;
555     UINT            NumElements           = D3DX11_DEFAULT;
556     UINT            Filter                = D3DX11_DEFAULT;
557     UINT            MipFilter             = D3DX11_DEFAULT;
558 }
559 
560 
561 //----------------------------------------------------------------------------
562 // D3DX11LoadTextureFromTexture:
563 // ----------------------------
564 // Load a texture from a texture.
565 //
566 // Parameters:
567 //
568 //----------------------------------------------------------------------------
569 
570 extern(Windows)
571 HRESULT
572     D3DX11LoadTextureFromTexture(
573 		ID3D11DeviceContext        pContext,
574         ID3D11Resource             pSrcTexture,
575         D3DX11_TEXTURE_LOAD_INFO*  pLoadInfo,
576         ID3D11Resource             pDstTexture);
577 
578 
579 //----------------------------------------------------------------------------
580 // D3DX11FilterTexture:
581 // ------------------
582 // Filters mipmaps levels of a texture.
583 //
584 // Parameters:
585 //  pBaseTexture
586 //      The texture object to be filtered
587 //  SrcLevel
588 //      The level whose image is used to generate the subsequent levels. 
589 //  MipFilter
590 //      D3DX11_FILTER flags controlling how each miplevel is filtered.
591 //      Or D3DX11_DEFAULT for D3DX11_FILTER_BOX,
592 //
593 //----------------------------------------------------------------------------
594 extern(Windows)
595 HRESULT
596     D3DX11FilterTexture(
597 		ID3D11DeviceContext       pContext,
598         ID3D11Resource            pTexture,
599         UINT                      SrcLevel,
600         UINT                      MipFilter);
601 
602 
603 //----------------------------------------------------------------------------
604 // D3DX11SaveTextureToFile:
605 // ----------------------
606 // Save a texture to a file.
607 //
608 // Parameters:
609 //  pDestFile
610 //      File name of the destination file
611 //  DestFormat
612 //      D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
613 //  pSrcTexture
614 //      Source texture, containing the image to be saved
615 //
616 //----------------------------------------------------------------------------
617 extern(Windows)
618 HRESULT
619     D3DX11SaveTextureToFileA(
620 		ID3D11DeviceContext        pContext,
621         ID3D11Resource             pSrcTexture,
622         D3DX11_IMAGE_FILE_FORMAT    DestFormat,
623         LPCSTR                    pDestFile);
624 		
625 extern(Windows)
626 HRESULT
627     D3DX11SaveTextureToFileW(
628 		ID3D11DeviceContext        pContext,
629         ID3D11Resource             pSrcTexture,
630         D3DX11_IMAGE_FILE_FORMAT    DestFormat,
631         LPCWSTR                   pDestFile);
632 		
633 alias D3DX11SaveTextureToFileW D3DX11SaveTextureToFile;
634 
635 
636 //----------------------------------------------------------------------------
637 // D3DX11SaveTextureToMemory:
638 // ----------------------
639 // Save a texture to a blob.
640 //
641 // Parameters:
642 //  pSrcTexture
643 //      Source texture, containing the image to be saved
644 //  DestFormat
645 //      D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
646 //  ppDestBuf
647 //      address of a d3dxbuffer pointer to return the image data
648 //  Flags
649 //      optional flags
650 //----------------------------------------------------------------------------
651 extern(Windows)
652 HRESULT
653     D3DX11SaveTextureToMemory(
654 		ID3D11DeviceContext        pContext,
655         ID3D11Resource             pSrcTexture,
656         D3DX11_IMAGE_FILE_FORMAT   DestFormat,
657         ID3D10Blob*                ppDestBuf,
658         UINT                       Flags);
659 
660 
661 //----------------------------------------------------------------------------
662 // D3DX11ComputeNormalMap:
663 // ---------------------
664 // Converts a height map into a normal map.  The (x,y,z) components of each
665 // normal are mapped to the (r,g,b) channels of the output texture.
666 //
667 // Parameters
668 //  pSrcTexture
669 //      Pointer to the source heightmap texture 
670 //  Flags
671 //      D3DX11_NORMALMAP flags
672 //  Channel
673 //      D3DX11_CHANNEL specifying source of height information
674 //  Amplitude
675 //      The constant value which the height information is multiplied by.
676 //  pDestTexture
677 //      Pointer to the destination texture
678 //---------------------------------------------------------------------------
679 extern(Windows)
680 HRESULT
681     D3DX11ComputeNormalMap(
682         ID3D11DeviceContext       pContext,
683         ID3D11Texture2D		      pSrcTexture,
684         UINT                      Flags,
685         UINT                      Channel,
686         FLOAT                     Amplitude,
687         ID3D11Texture2D		      pDestTexture);
688 
689 
690 //----------------------------------------------------------------------------
691 // D3DX11SHProjectCubeMap:
692 // ----------------------
693 //  Projects a function represented in a cube map into spherical harmonics.
694 //
695 //  Parameters:
696 //   Order
697 //      Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
698 //   pCubeMap
699 //      CubeMap that is going to be projected into spherical harmonics
700 //   pROut
701 //      Output SH vector for Red.
702 //   pGOut
703 //      Output SH vector for Green
704 //   pBOut
705 //      Output SH vector for Blue        
706 //
707 //---------------------------------------------------------------------------
708 extern(Windows)
709 HRESULT
710     D3DX11SHProjectCubeMap(
711         ID3D11DeviceContext                                pContext,
712         UINT                                               Order,
713         ID3D11Texture2D                                    pCubeMap,
714         FLOAT*                                             pROut,
715         FLOAT*                                             pGOut,
716 		FLOAT*                                             pBOut);